home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / vg-2.03 / menu.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-03  |  1.7 KB  |  79 lines

  1. /*
  2.  * Copyright (C) 1990-1992 by Michael Davidson.
  3.  * All rights reserved.
  4.  *
  5.  * Permission to use, copy, modify, and distribute this software
  6.  * and its documentation for any purpose and without fee is hereby
  7.  * granted, provided that the above copyright notice appear in all
  8.  * copies and that both that copyright notice and this permission
  9.  * notice appear in supporting documentation.
  10.  *
  11.  * This software is provided "as is" without express or implied warranty.
  12.  */
  13.  
  14. /*
  15.  * menu utilities
  16.  */
  17. #include    <stdio.h>
  18. #include    "vg.h"
  19. #include    "text.h"
  20. #include    "kbd.h"
  21.  
  22. extern void    *alloca(int);
  23.  
  24. menuBorders(
  25.     int        x,
  26.     int        y,
  27.     int        w,
  28.     int        h,
  29.     char    *title,
  30.     char    *labels
  31.     )
  32. {
  33.     int        i;
  34.     int        fg;
  35.     int        bg;
  36.     char    *line    = alloca(w);
  37.  
  38.     fg        = 0x0B;
  39.     bg        = 0x01;
  40.  
  41.     memset(line, HORIZONTAL_LINE, w);
  42.     line[0] = TOP_LEFT_CORNER;
  43.     line[w-1] = TOP_RIGHT_CORNER;
  44.     vidPutText(x, y, line, w, fg, bg);
  45.  
  46.     line[0] = BOT_LEFT_CORNER;
  47.     line[w-1] = BOT_RIGHT_CORNER;
  48.     vidPutText(x, y+h-1, line, w, fg, bg);
  49.  
  50.  
  51.     memset(line, ' ', w);
  52.     line[0] = VERTICAL_LINE;
  53.     line[w-1] = VERTICAL_LINE;
  54.     for (i = 1; i < h-1; i++)
  55.         vidPutText(x, y+i, line, w, fg, bg);
  56.  
  57.     memset(line, HORIZONTAL_LINE, w);
  58.     line[0]    = LEFT_TEE;
  59.     line[w-1]    = RIGHT_TEE;
  60.     vidPutText(x, y+2, line, w, fg, bg);
  61.     vidPutText(x, y+h-3, line, w, fg, bg);
  62.  
  63.     sprintf(line, "ESC=Exit");
  64.     i    = strlen(line);
  65.     vidPutText(x+2, y+1, line, strlen(line), fg, bg);
  66.  
  67.     i    = strlen(title);
  68.     if (i > 32)
  69.     i = 32;
  70.     vidPutText(x+ (w - i) / 2, y+ 1, title, i, fg, bg);
  71.  
  72.     sprintf(line, "ENTER=Show");
  73.     i    = strlen(line);
  74.     vidPutText(x+(w-i)-2, y+1, line, strlen(line), fg, bg);
  75.  
  76.     i = strlen(labels);
  77.     vidPutText(x+3, y+h-2, labels, i, fg, bg);
  78. }
  79.